package org.huawei.controller;

import javafx.stage.Stage;
import org.huawei.dao.RoleDao;
import org.huawei.annotations.RateLimit;

import java.sql.SQLException;
import java.util.List;

public class RoleController {
    private Stage stage;
    private RoleDao roleDao;

    public RoleController(Stage stage) {
        this.stage = stage;
        this.roleDao = new RoleDao();
    }

    @RateLimit
    public List<String> getAllRoleNames() throws SQLException {
        return roleDao.getAllRoleNames();
    }

    @RateLimit
    public int getRoleIdByRoleName(String roleName) {
        return roleDao.getRoleIdByRoleName(roleName);
    }

    @RateLimit
    public String getRoleNameByRoleId(int roleId) {
        return roleDao.getRoleNameByRoleId(roleId);
    }
}
